import wx 
class CustomStatusBar(wx.StatusBar):
    '''Statusbar class with some customfields'''
    def __init__(self, parent):
        wx.StatusBar.__init__(self, parent, wx.ID_ANY)

        # This status bar has three fields
        self.SetFieldsCount(2)
        self.SetStatusWidths([-1, 200])

    def SetPerspective(self, text):
        font = self.GetFont()
        dc = wx.WindowDC(self)
        dc.SetFont(font)
        width, height = dc.GetTextExtent(text)
        # add a little to the width to account for the reszie grip
        self.SetStatusWidths([-1, width+30])
        self.SetStatusText(text, 1)

